package com.varton.theory;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;

/**
 *
 * @author lihuazeng
 */
public class MyClassLoader extends ClassLoader{
    public Class<?> getProxyObjClass(String classPath){
        try {
            byte[] bytes = new byte[1024];
            FileInputStream fis = new FileInputStream(new File(classPath));
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            int len = 0;
            while ((len = fis.read(bytes)) != -1){
                baos.write(bytes,0, len);
            }
            return this.defineClass("com.varton.theory.Proxy$10", baos.toByteArray(), 0, baos.size());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}